package springbootjedis.wqlbootjedis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import springbootjedis.wqlbootjedis.entity.Dept;
import springbootjedis.wqlbootjedis.service.DeptService;

import java.nio.channels.Pipe;

/**
 * @author wql
 * @version 1.0
 * @date 2022/12/7 14:08
 */
@RestController
@RequestMapping("/dept")
public class DeptController {
    @Autowired
    private DeptService deptService;

    @GetMapping("/{id}")
    public Dept SelectById(@PathVariable(value = "id")Integer id){
        return deptService.SelectById(id);
    }

    @DeleteMapping("{id}")
    public Integer delete(@PathVariable(value = "id") Integer id){
        return deptService.delete(id);
    }
    @PostMapping
    public Dept save (@RequestBody Dept dept){
        return deptService.save(dept);
    }

    @PutMapping
    public Dept update(@RequestBody Dept dept){
        return  deptService.update(dept);
    }
}
